package code._15network.tcp.v2;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Scanner;

public class client {
    public static void main(String[] args) throws IOException {
        //创建socket对象
        Socket socket = new Socket("127.0.0.1", 9999);
        //创建scanner对象
        Scanner scanner = new Scanner(System.in);
        //获取socket的输出流
        OutputStream socketOut = socket.getOutputStream();
        //发送数据  while
        while(true){
            String msg = scanner.nextLine();
            socketOut.write(msg.getBytes());
        }

    }
}
